# 三种出路 　以不同的方式完成练习7-4或练习7-5，在程序中采取如下做法。
# 在while 循环中使用条件测试来结束循环。
# 使用变量active 来控制循环结束的时机。
# 使用break 语句在用户输入'quit' 时退出循环。

prompt = "\nTell me how old you are?"
prompt += "\nEnter 'quit' to end the program: "

age = ""
while age != 'quit':
	age = input(prompt)
	# 在while 循环中使用条件测试来结束循环。
	if age != 'quit':
		age = int(age)
		if age <= 3:
			print("You are free to see a movie!")
		elif age <= 12:
			print("You need to pay $10 for your ticket.")
		else:
			print("You need to pay $15 for your ticket.")



prompt = "\nTell me how old you are?"
prompt += "\nEnter 'quit' to end the program: "

active = True
while active:
	age = input(prompt)
	# 使用变量active 来控制循环结束的时机。
	if age == 'quit':
		active = False
	else:
		age = int(age)
		if age <= 3:
			print("You are free to see a movie!")
		elif age <= 12:
			print("You need to pay $10 for your ticket.")
		else:
			print("You need to pay $15 for your ticket.")


# 使用break 语句在用户输入'quit' 时退出循环。
prompt = "\nTell me how old you are?"
prompt += "\nEnter 'quit' to end the program: "

while True:
	age = input(prompt)
	# 使用变量active 来控制循环结束的时机。
	if age == 'quit':
		break
	else:
		age = int(age)
		if age <= 3:
			print("You are free to see a movie!")
		elif age <= 12:
			print("You need to pay $10 for your ticket.")
		else:
			print("You need to pay $15 for your ticket.")